<?php
	session_start();
	$func = $_POST["func"];
	switch($func) {
		case "register":
			require "class.user.php";
			print User::register($_POST["user"], $_POST["password"], $_POST["email"]);
			break;
		case "login":
			require "class.user.php";
			if (User::login($_POST["user"], $_POST["password"]) == "SUCCESS") {
				$_SESSION["mnwiki_user"] = $_POST["user"];
				print "SUCCESS";
			}
			break;
		case "logout":
			unset($_SESSION["mnwiki_user"]);
			break;
		default:
			break;
	}
?>
